<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: rtos.c File Reference</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>rtos.c File Reference</h1>RTOS - Real Time Operating System. <a href="#_details">More...</a>
<p>

<p>
<a href="rtos_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g9a64a7c0e24f257826103d1d1bbb44fa">Sleep</a> (int timems)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Put a task to sleep for a given number of milliseconds.  <a href="group___tasks.html#g9a64a7c0e24f257826103d1d1bbb44fa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#gbe9e0304997a15f46d9eae37be16e3f2">TaskYield</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Give up the remaining time allotted to this task by the processor.  <a href="group___tasks.html#gbe9e0304997a15f46d9eae37be16e3f2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g784f87fb45eebb76d07478036ed228d3">TaskCreate</a> (void(taskCode)(void *), char *name, int stackDepth, void *parameters, int priority)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a new task.  <a href="group___tasks.html#g784f87fb45eebb76d07478036ed228d3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g5bc41573c59208d32d999e2f394ad3ce">TaskDelete</a> (void *task)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Delete an existing task.  <a href="group___tasks.html#g5bc41573c59208d32d999e2f394ad3ce"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#gd02e088c48f69fd07cf3157bcceb01b7">TaskEnterCritical</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Specify that a task is entering a period during which it should not be interrupted.  <a href="group___tasks.html#gd02e088c48f69fd07cf3157bcceb01b7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g0911fd273992ff4dec66d096a9dc3257">TaskExitCritical</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Specify that a task is exiting a critical period, in response to <a class="el" href="group___tasks.html#gd02e088c48f69fd07cf3157bcceb01b7" title="Specify that a task is entering a period during which it should not be interrupted...">TaskEnterCritical()</a>.  <a href="group___tasks.html#g0911fd273992ff4dec66d096a9dc3257"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#gbce595eac3d0cfb96b1cd9037a613ef8">TaskGetRemainingStack</a> (void *task)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check how much stack is available for a given task.  <a href="group___tasks.html#gbce595eac3d0cfb96b1cd9037a613ef8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#gdd4c687d4df17e7eee740e3e8bc103c8">getTaskByName</a> (char *taskName)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get a pointer to a task by its name.  <a href="group___tasks.html#gdd4c687d4df17e7eee740e3e8bc103c8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#ge92ca2261fff9550cc18ac991afafd01">getTaskByID</a> (int taskID)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get a pointer to a task by its ID number.  <a href="group___tasks.html#ge92ca2261fff9550cc18ac991afafd01"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g0b8075007b824b2295dc5d3453a372fb">TaskGetPriority</a> (void *task)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the priority of a task.  <a href="group___tasks.html#g0b8075007b824b2295dc5d3453a372fb"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g39806aeaa7dd24062f13c3118ca1b990">TaskGetIDNumber</a> (void *task)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the ID number of a task.  <a href="group___tasks.html#g39806aeaa7dd24062f13c3118ca1b990"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#ga15296e2b927abaadce9ed3028917afd">TaskGetName</a> (void *task)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the name of a task.  <a href="group___tasks.html#ga15296e2b927abaadce9ed3028917afd"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g7bbfe88356db1ef137b85881a1074e29">TaskGetStackAllocated</a> (void *task)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read the amount of stack initially allocated for a task.  <a href="group___tasks.html#g7bbfe88356db1ef137b85881a1074e29"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g8026e84bd2096796b7899a35dee6f060">TaskGetCurrent</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get a pointer to the task that's currently running.  <a href="group___tasks.html#g8026e84bd2096796b7899a35dee6f060"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g4f0b02fb8a36b62908efd6b649339d19">TaskGetTopPriorityUsed</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read the highest priority being used by any existing task.  <a href="group___tasks.html#g4f0b02fb8a36b62908efd6b649339d19"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#ga8d7aef54edaea894b5f5e9cd6c53eae">TaskGetNext</a> (void *task)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get a pointer to the task whose ID comes after a given ID.  <a href="group___tasks.html#ga8d7aef54edaea894b5f5e9cd6c53eae"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g87597a6d75dce6de737707604d4267ce">GetNumberOfTasks</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the total number of tasks that exist at a given moment.  <a href="group___tasks.html#g87597a6d75dce6de737707604d4267ce"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#g713d7e60380194c8a1ff830c80f37061">TaskSetPriority</a> (void *task, int priority)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Update the priority of a task.  <a href="group___tasks.html#g713d7e60380194c8a1ff830c80f37061"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tasks.html#gc899bfb04919f3af158289bdcb2901de">TaskGetTickCount</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of ticks since the scheduler started.  <a href="group___tasks.html#gc899bfb04919f3af158289bdcb2901de"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___utils.html#gf8ee6a74b03a39bce7c3b7d95fea303c">Malloc</a> (int size)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Dynamically allocate memory from the heap.  <a href="group___utils.html#gf8ee6a74b03a39bce7c3b7d95fea303c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___utils.html#g95923aa748602fa0330903fca05ca892">MallocWait</a> (int size, int interval)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Same as Malloc, but keeps trying until it succeeds.  <a href="group___utils.html#g95923aa748602fa0330903fca05ca892"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___utils.html#g6b0be54448d6ce393134400f4b22fa97">Free</a> (void *memory)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Free memory from the heap.  <a href="group___utils.html#g6b0be54448d6ce393134400f4b22fa97"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___queues.html#gc2d1cdfeaaa00285b5c67260c0d2a64d">QueueCreate</a> (uint length, uint itemSize)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a new queue.  <a href="group___queues.html#gc2d1cdfeaaa00285b5c67260c0d2a64d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___queues.html#gcb0105420a21d83abeb9abc04f412e9f">QueueSendToFront</a> (void *queue, void *itemToQueue, int msToWait)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Post an item onto the front of a queue.  <a href="group___queues.html#gcb0105420a21d83abeb9abc04f412e9f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___queues.html#g24a3155b7ac8bd256eeb82bcc4b6d9aa">QueueSendToBack</a> (void *queue, void *itemToQueue, int msToWait)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Post an item onto the back of a queue.  <a href="group___queues.html#g24a3155b7ac8bd256eeb82bcc4b6d9aa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___queues.html#ge6957dcef9dfcf94627ddf6b56e46983">QueueReceive</a> (void *queue, void *buffer, int msToWait)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read an item off of a queue.  <a href="group___queues.html#ge6957dcef9dfcf94627ddf6b56e46983"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___queues.html#g900ddfe9c08c30101e5dce0eb8572ed3">QueueMessagesWaiting</a> (void *queue)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the number of messages waiting in a queue.  <a href="group___queues.html#g900ddfe9c08c30101e5dce0eb8572ed3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___queues.html#g732b8a550d25382ecbf8f28744a5199d">QueueDelete</a> (void *queue)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Delete a queue - freeing all the memory allocated for storing of items placed on the queue.  <a href="group___queues.html#g732b8a550d25382ecbf8f28744a5199d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___queues.html#gbd4e727f53b330ab99f56db41459e5ad">QueueSendToFrontFromISR</a> (void *queue, void *itemToSend, int taskPreviouslyWoken)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Post an item to the front of a queue from within an interrupt service routine.  <a href="group___queues.html#gbd4e727f53b330ab99f56db41459e5ad"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___queues.html#gba2ceb616e0eac3cb7346ed0f76ecc23">QueueSendToBackFromISR</a> (void *queue, void *itemToSend, int taskPreviouslyWoken)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Post an item to the back of a queue from within an interrupt service routine.  <a href="group___queues.html#gba2ceb616e0eac3cb7346ed0f76ecc23"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___queues.html#g3d94a308309a75f2c3c9a6fd1bbfc712">QueueReceiveFromISR</a> (void *queue, void *buffer, long *taskWoken)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Receive an item from a queue from within an interrupt service routine.  <a href="group___queues.html#g3d94a308309a75f2c3c9a6fd1bbfc712"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___semaphores_mutexes.html#gfa1700ecb9afca5ad4c1bcd832039838">SemaphoreCreate</a> (void *semaphore)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a semaphore.  <a href="group___semaphores_mutexes.html#gfa1700ecb9afca5ad4c1bcd832039838"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___semaphores_mutexes.html#g2637a3b208dd56f3313a7b3b3d9ea55d">SemaphoreTake</a> (void *semaphore, int blockTime)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Obtain a semaphore.  <a href="group___semaphores_mutexes.html#g2637a3b208dd56f3313a7b3b3d9ea55d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___semaphores_mutexes.html#gf6b6a05f387c0c8c671fe8c2491a5d43">SemaphoreGive</a> (void *semaphore)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Release a semaphore.  <a href="group___semaphores_mutexes.html#gf6b6a05f387c0c8c671fe8c2491a5d43"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___semaphores_mutexes.html#g4d883250a869e5064e92a3ae7ebc5c9e">SemaphoreGiveFromISR</a> (void *semaphore, int taskWoken)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Release a semaphore from within an ISR.  <a href="group___semaphores_mutexes.html#g4d883250a869e5064e92a3ae7ebc5c9e"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
RTOS - Real Time Operating System. 
<p>
Functions to work within FreeRTOS on the Make Controller Board. 
<p>Definition in file <a class="el" href="rtos_8c-source.html">rtos.c</a>.</p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
